package com.upcode.weighing.config;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;

/**
 * @program: nsop
 * @description: 支付宝配置文件
 * @author: miaosy
 * @create: 2018-06-06 18:16
 */
public class AliPayConfig {

    private String serverUrl;

    private String codeSet;

    private String appId;

    private String privateKey;

    private String aliPayPublicKey;

    private String signType;

    private String maxQueryRetry;

    private String queryDuration;

    private String maxCancelRetry;

    private String cancelDuration;

    private String heartbeatDelay;

    private String heartbeatDuration;

    public String getServerUrl() {
        return serverUrl;
    }

    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    public String getCodeSet() {
        return codeSet;
    }

    public void setCodeSet(String codeSet) {
        this.codeSet = codeSet;
    }

    public String getSignType() {
        return signType;
    }

    public void setSignType(String signType) {
        this.signType = signType;
    }

    public String getMaxQueryRetry() {
        return maxQueryRetry;
    }

    public void setMaxQueryRetry(String maxQueryRetry) {
        this.maxQueryRetry = maxQueryRetry;
    }

    public String getQueryDuration() {
        return queryDuration;
    }

    public void setQueryDuration(String queryDuration) {
        this.queryDuration = queryDuration;
    }

    public String getMaxCancelRetry() {
        return maxCancelRetry;
    }

    public void setMaxCancelRetry(String maxCancelRetry) {
        this.maxCancelRetry = maxCancelRetry;
    }

    public String getCancelDuration() {
        return cancelDuration;
    }

    public void setCancelDuration(String cancelDuration) {
        this.cancelDuration = cancelDuration;
    }

    public String getHeartbeatDelay() {
        return heartbeatDelay;
    }

    public void setHeartbeatDelay(String heartbeatDelay) {
        this.heartbeatDelay = heartbeatDelay;
    }

    public String getHeartbeatDuration() {
        return heartbeatDuration;
    }

    public void setHeartbeatDuration(String heartbeatDuration) {
        this.heartbeatDuration = heartbeatDuration;
    }

    public String getAppId() {
        return appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getPrivateKey() {
        return privateKey;
    }

    public void setPrivateKey(String privateKey) {
        this.privateKey = privateKey;
    }

    public String getAliPayPublicKey() {
        return aliPayPublicKey;
    }

    public void setAliPayPublicKey(String aliPayPublicKey) {
        this.aliPayPublicKey = aliPayPublicKey;
    }
    /**
     * 获取支付宝支付配置
     * @param configParam
     * @return
     */
    public static AliPayConfig getAliPayConfig(String configParam) {
        AliPayConfig config = new AliPayConfig();
        JSONObject paramObj = JSON.parseObject(configParam);
        config.setPrivateKey(paramObj.getString("privateKey"));
        config.setAppId(paramObj.getString("appId"));
        config.setAliPayPublicKey(paramObj.getString("publicKey"));
        return config;
    }
}
